]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
workspace: Remove skip-taskbar windows while the overview is shown
authorDaniel van Vugt <daniel.van.vugt@canonical.com>
Fri, 23 Jul 2021 09:33:43 +0000 (17:33 +0800)
committerMarge Bot <marge-bot@gnome.org>
Wed, 11 Aug 2021 15:15:03 +0000 (15:15 +0000)
On startup desktop-icons-ng Wayland windows have skip-taskbar==FALSE so
initially pass `_isOverviewWindow` and they get added to the overview,
which is confusing to users. However almost immediately after that they
get `meta_wayland_client_hide_from_window_list` and are removed from
future overviews. So now we respond to `notify::skip-taskbar` immediately
and prevent desktop-icons-ng appearing in the startup overview too.

This is messy and ideally we'd like to know the window type immediately
on creation, but that option only exists in X11 and not Wayland.

https://gitlab.com/rastersoft/desktop-icons-ng/-/issues/137
https://bugs.launchpad.net/bugs/1936643

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1925>

js/ui/workspace.js

index 7e6018fbd3d9b01e545a40785cb058665f75829e..7bc3cdfb67c59a31caca82b4d5b1b36f065e39d0 100644 (file)
@@ -1106,6 +1106,7 @@ class Workspace extends St.Widget {
         this.connect('style-changed', this._onStyleChanged.bind(this));
         this.connect('destroy', this._onDestroy.bind(this));
 
+        this._skipTaskbarSignals = new Map();
         const windows = global.get_window_actors().map(a => a.meta_window)
             .filter(this._isMyWindow, this);
 
@@ -1232,6 +1233,14 @@ class Workspace extends St.Widget {
         if (!this._isMyWindow(metaWin))
             return;
 
+        this._skipTaskbarSignals.set(metaWin,
+            metaWin.connect('notify::skip-taskbar', () => {
+                if (metaWin.skip_taskbar)
+                    this._doRemoveWindow(metaWin);
+                else
+                    this._doAddWindow(metaWin);
+            }));
+
         if (!this._isOverviewWindow(metaWin)) {
             if (metaWin.get_transient_for() == null)
                 return;
@@ -1300,7 +1309,15 @@ class Workspace extends St.Widget {
         return false;
     }
 
+    _clearSkipTaskbarSignals() {
+        for (const [metaWin, id] of this._skipTaskbarSignals)
+            metaWin.disconnect(id);
+        this._skipTaskbarSignals.clear();
+    }
+
     prepareToLeaveOverview() {
+        this._clearSkipTaskbarSignals();
+
         for (let i = 0; i < this._windows.length; i++)
             this._windows[i].remove_all_transitions();
 
@@ -1314,6 +1331,8 @@ class Workspace extends St.Widget {
     }
 
     _onDestroy() {
+        this._clearSkipTaskbarSignals();
+
         if (this._overviewHiddenId) {
             Main.overview.disconnect(this._overviewHiddenId);
             this._overviewHiddenId = 0;